<?php
class Form_User_Register extends Zend_Form 
{
	public function __construct($options = null){
		parent::__construct($options);  
		
		$password = new Zend_Form_Element_Password('password', array('id'=>'i2' , 'class'=>'text'));
		$password->setRequired(true);
		$submit = new Zend_Form_Element_Submit('submit', array('class'=>'btn-reg','label'=>'зарегистрироваться'));

		$name = new Zend_Form_Element_Text('name',  
		  array('filters' => array('StripTags','StringTrim'), 'id'=>'i2' , 'class'=>'text')
	    );
	    $surname = new Zend_Form_Element_Text('surname', 
          array('filters' => array('StripTags','StringTrim'), 'id'=>'i1' , 'class'=>'text')
        );
        $fathername = new Zend_Form_Element_Text('fathername', 
          array('filters' => array('StripTags','StringTrim'), 'id'=>'i3' , 'class'=>'text')
        );
        $year = new Zend_Form_Element_Text('year', 
          array('filters' => array('StripTags','StringTrim'),'id'=>'i4' , 'class'=>'text')
        );
        $year->setValidators(array(new Zend_Validate_Digits()));
        $year->setRequired(true);
        $size = new Zend_Form_Element_Text('size', 
          array('filters' => array('StripTags','StringTrim'),'validator'=>'Digits','id'=>'i5' , 'class'=>'text')
        );
        $size->setValidators(array(new Zend_Validate_Digits()));
        $size->setRequired(true);
        $gender = new Zend_Form_Element_Select('gender',array('class'=>'sel-2'));
            $gender->addMultiOption('0','Женский');
            $gender->addMultiOption('1','Мужской');
            $gender->addMultiOption('2','Ребёнок');
        $phone = new Zend_Form_Element_Text('phone', 
          array('filters' => array('StripTags','StringTrim'),'id'=>'i7' , 'class'=>'text')
        );
        $email = new Zend_Form_Element_Text('email', 
          array('filters' => array('StripTags','StringTrim'), 'id'=>'i8' , 'class'=>'text')
        );
        $email->setValidators(array( new Zend_Validate_EmailAddress(), new App_Validate_NoDbRecordExists('user','email')));
        $email->setRequired(true);
        $this->addElements(array($password,$name, $surname, $fathername, $year, $size, $gender,$phone ,$email, $submit));
	        foreach($this->getElements() as $element){
            $element->clearDecorators()->addDecorator("ViewHelper");
        }
	}
}